package cn.com.hotgroup.webspider.util;

import java.util.Map;

import cn.com.hotgroup.webspider.domain.Product;

public class ProductCreater {
	private final static String DEFAULT_WEIGHT = "1";

	public static Product createProduct(Map<String, String> fieldMap) {
		Product pro = new Product();

		pro.setStore(Product.STORE);
		pro.setWebsites(Product.WEBSITES);
		pro.setAttribute_set(Product.ATTRIBUTE_SET);
		pro.setType(Product.TYPE);
		pro.setCategories(fieldMap.get("categories"));
		pro.setModel(fieldMap.get("model"));
		pro.setSku(fieldMap.get("sku"));
		pro.setHas_options(Product.HAS_OPTIONS);
		pro.setName(fieldMap.get("name"));
		pro.setUrl_key(fieldMap.get("url_key"));
		pro.setMsrp_enabled(Product.MSRP_ENABLED);
		pro.setMsrp_display_actual_price_type(Product.MSRP_DISPLAY_ACTUAL_PRICE_TYPE);
		pro.setThumbnail(fieldMap.get("thumbnail"));
		pro.setSmall_image(fieldMap.get("small_image"));
		pro.setImage(fieldMap.get("image"));
		pro.setGallery(fieldMap.get("gallery"));
		pro.setOptions_container(Product.OPTIONS_CONTAINER);
		pro.setPage_layout(Product.PAGE_LAYOUT);
		pro.setGift_message_available(Product.GIFT_MESSAGE_AVAILABLE);
		pro.setUrl_path(Product.URL_PATH);
		pro.setWeight(DEFAULT_WEIGHT);
		pro.setPrice(fieldMap.get("price"));
		pro.setSpecial_price(fieldMap.get("special_price"));
		pro.setDescription(fieldMap.get("description"));
		pro.setShort_description(fieldMap.get("short_description"));
		pro.setStatus(Product.STATUS);
		pro.setTax_class_id(Product.TAX_CLASS_ID);
		pro.setVisibility(Product.VISIBILITY);
		pro.setColor(fieldMap.get("color"));
		pro.setEnable_googlecheckout(Product.ENABLE_GOOGLECHECKOUT);
		pro.setIs_recurring(Product.IS_RECURRING);
		pro.setCountry_of_manufacture("");
		pro.setManufacturer("");
		pro.setQty(Product.QTY);
		pro.setIs_in_stock(Product.IS_IN_STOCK);
		return pro;

	}
}
